Skip to content

Add options for NonEq relaxation timescales as functions of N and T#676

Open
oalcabes wants to merge 1 commit into
mainfrom
oa/tau_i_temp_dependence
Open

Add options for NonEq relaxation timescales as functions of N and T#676
oalcabes wants to merge 1 commit into
mainfrom
oa/tau_i_temp_dependence

Conversation

@oalcabes
Copy link
Copy Markdown
Member

@oalcabes oalcabes commented Feb 11, 2026

Draft PR to make new versions of the NonEq scheme, namely tau(T) and tau(N) functionality. Still need to review docs and think carefully about testing, but I'd love comments and thoughts on the PR! This may break atmos as I've made changes to the bulk_microphysics_tendency function.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 62.06897% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.62%. Comparing base (14ef3e6) to head (019d9a7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #676      +/-   ##
==========================================
- Coverage   92.02%   91.62%   -0.41%     
==========================================
  Files          54       54              
  Lines        2321     2341      +20     
==========================================
+ Hits         2136     2145       +9     
- Misses        185      196      +11     
Components Coverage Δ
src 92.56% <62.06%> (-0.43%) ⬇️
ext 69.47% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@oalcabes oalcabes changed the title Add temperature dependent relaxation timescale for NonEq Add options for NonEq relaxation timescales as functions of N and T Feb 13, 2026
@oalcabes oalcabes force-pushed the oa/tau_i_temp_dependence branch 3 times, most recently from cf55a81 to 9346e0c Compare February 13, 2026 22:50
@oalcabes oalcabes requested a review from trontrytel February 13, 2026 22:52
@oalcabes oalcabes added the NonEq 💧🧊 Non equilibrium microphysics label Feb 13, 2026
Comment thread docs/src/MicrophysicsNonEq.md Outdated
Comment thread docs/src/API.md
MicrophysicsNonEq.τ_relax
MicrophysicsNonEq.conv_q_vap_to_q_lcl_icl
MicrophysicsNonEq.conv_q_vap_to_q_lcl_MM2015
MicrophysicsNonEq.conv_q_vap_to_q_icl_MM2015
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want to keep MicrophysicsNonEq.conv_q_vap_to_q_icl_MM2015?

Copy link
Copy Markdown
Member Author

@oalcabes oalcabes Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we would keep "MicrophysicsNonEq.conv_q_vap_to_q_lcl_MM2015" and "MicrophysicsNonEq.conv_q_vap_to_q_icl_MM2015" and delete "MicrophysicsNonEq.conv_q_vap_to_q_lcl_icl_MM2015" - I was leaving it now for backwards compatibility but if we're okay with a breaking release I can just delete it


# Using same limiter as ClimaAtmos for now
# Not sure why, but without intermediate storing of the tendencies for the
# if/else branch this code segfaults on julia v1.11 (works fine on v1.10)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. But I have seen this before too :/

@oalcabes oalcabes force-pushed the oa/tau_i_temp_dependence branch from 0e64b5e to ab706fb Compare April 1, 2026 22:50
@oalcabes oalcabes force-pushed the oa/tau_i_temp_dependence branch 2 times, most recently from 0d2eda2 to 9bffcec Compare April 30, 2026 18:47
@oalcabes oalcabes force-pushed the oa/tau_i_temp_dependence branch 3 times, most recently from caabc3d to 22cafcc Compare May 8, 2026 20:38
Comment thread src/BulkMicrophysicsTendencies.jl
@oalcabes oalcabes marked this pull request as ready for review May 8, 2026 21:20
@oalcabes oalcabes requested a review from sajjadazimi May 8, 2026 21:20
@oalcabes
Copy link
Copy Markdown
Member Author

oalcabes commented May 8, 2026

Hi @trontrytel and @sajjadazimi -- I'm coming back to this PR. The PR is doing three main things, namely: (1) refactors the NonEquilibrium parameterization to accept tau as an argument rather than calculating it inside of the function (2) introduce a version of tau_i calculated from Frostenberg et. al. (2023) and (3) add parcel and documentation examples for the Frostenberg option. For now I would like to focus most on the refactoring change -- if you all like it we can keep it in this PR, but if you have major comments perhaps I'll do it in a separate PR.

@oalcabes
Copy link
Copy Markdown
Member Author

oalcabes commented May 8, 2026

I specifically desire comments on src/BulkMicrophysicsTendencies.jl

Comment thread src/BulkMicrophysicsTendencies.jl Outdated
if noneq_scheme isa NonEq_Constant
τₗ = lcl.τ_relax
τᵢ = icl.τ_relax
elseif noneq_scheme isa NonEq_N # this assumes we're using the Frostenberg parameterization for τᵢ
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To decide: do we want to have liquid calculated like this as well, or just keep the ice relaxation timescale changing instead?

Comment thread src/BulkMicrophysicsTendencies.jl Outdated
- `warm_rain`
- `sb`: SB2006 parameters
- `aps`: air property parameters % OLIVIA CLEAN THIS UP -- also missing ice???
- `noneq_scheme` Type of NonEquilibrium scheme to use (NOT NECESSARILY NEEDED BUT KEEP IT FOR THE FUTURE)
Copy link
Copy Markdown
Member Author

@oalcabes oalcabes May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently passing this flag but not using it yet -- may not be necessary if we decide to keep tau_l always constant for now and only change tau_i

@oalcabes oalcabes force-pushed the oa/tau_i_temp_dependence branch from 22cafcc to 019d9a7 Compare May 8, 2026 21:37
Copy link
Copy Markdown
Member

@sajjadazimi sajjadazimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for refactoring and adding the options for relaxation time scale. It looks good overall. I left a few minor comments.

\end{equation}
```

where ``q_c`` is the mass of condensate and ``ρ_c`` is the density of the condensate (either liquid or water). Then, we calculate the relaxation timescale:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

liquid or water?

N_i(T) = ln(-(b \cdot T)^9 \times 10^{-9})
```

``\sigma^2`` is the variance, ``a`` and ``b`` are coefficients. The parameters defined in [Frostenberg2023](@cite) for marine data sets are ``\sigma=1.37``, ``a=1`` m``^3``, ``b=1``/C.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only see b in the eq

Comment on lines +80 to +93
"""
NonEq Scheme

Abstract type for NonEquilibrium microphysics parameterizations. Namely,
this scheme specifies how to set the relaxation timescales (τₗ, τᵢ) for
liquid condensation/evaporation and ice deposition/sublimation.
NonEq_Constant sets τₗ and τᵢ are determined by the τ_relax arguments in
lcl and icl, whereas NonEq_N calculates τₗ and τᵢ from liquid and ice
number concentration.
"""
abstract type NonEqScheme end
struct NonEq_Constant <: NonEqScheme end
struct NonEq_N <: NonEqScheme end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's better to move this struct definition to NoneqMicrophysics

Comment on lines +117 to +118
::Microphysics1Moment,
noneq_scheme::NonEqScheme,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noneq_scheme could be an element of Microphysics1Moment. I see Microphysics1Moment as an umbrella that could define what submodels should be including the non equilibrium scheme.
This is not a strong opinion, so ignore if it's not possible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Otherwise we will start to have to carry more parameters in Microphysics1Moment than what we actually need for a single simulation

Comment on lines +215 to +221
if noneq_scheme isa NonEq_Constant
τₗ = lcl.τ_relax
τᵢ = icl.τ_relax
elseif noneq_scheme isa NonEq_N
τₗ = CMNonEq.τ_N(q_icl, N_lcl, lcl.ρw, aps.D_vapor)
τᵢ = CMNonEq.τ_Frostenberg(icl, aps, ip, q_icl, T)
end
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For code readability, you could dispatch over noneq_scheme and return the tuple of tau_l and tau_i

- `dn_rai_dt`: Rain number tendency (1/kg/s)
"""
@inline function warm_rain_tendencies_2m(warm_rain, tps, T, q_tot, q_lcl, q_rai, q_ice, ρ, n_lcl, n_rai)
@inline function warm_rain_tendencies_2m(warm_rain, noneq_scheme, tps, T, q_tot, q_lcl, q_rai, q_ice, ρ, n_lcl, n_rai)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as 1m: noneq_scheme could live under warm_rain model

"""
@inline function bulk_microphysics_tendencies(
::Microphysics2Moment, mp::CMP.Microphysics2MParams{WR, Nothing}, tps,
::Microphysics2Moment, noneq_scheme::NonEqScheme, mp::CMP.Microphysics2MParams{WR, Nothing}, tps,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Comment thread src/MicrophysicsNonEq.jl
Comment on lines +43 to +44
@inline τ_relax(p::CMP.CloudLiquid) = p.τ_relax
@inline τ_relax(p::CMP.CloudIce) = p.τ_relax
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, you could dispatch over non-eq method too


### Liquid and ice relaxation timescales as functions of number concentration

We also provide functionality to set the relaxation timescales of liquid and ice, ``\tau_l`` and ``\tau_i``, as functions of cloud droplet number concentrations ``N_l`` and ``N_i`` following [MorrisonGrabowski2008_supersat](@cite) and [MorrisonMilbrandt2015](@cite). First, we approximate average radius of droplets from mass and number:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We also provide functionality to set the relaxation timescales of liquid and ice, ``\tau_l`` and ``\tau_i``, as functions of cloud droplet number concentrations ``N_l`` and ``N_i`` following [MorrisonGrabowski2008_supersat](@cite) and [MorrisonMilbrandt2015](@cite). First, we approximate average radius of droplets from mass and number:
We also provide functionality to set the relaxation timescales of liquid and ice, ``\tau_l`` and ``\tau_i``, as functions of cloud droplet and ice crystal number concentrations ``N_l`` and ``N_i`` following [MorrisonGrabowski2008_supersat](@cite) and [MorrisonMilbrandt2015](@cite). First, we approximate average radius of droplets from mass and number:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NonEq 💧🧊 Non equilibrium microphysics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants